#pragma once

#include "../GameObject.h"
#include <vector>
#include <unordered_map>

class Room;
typedef std::shared_ptr<Room> RoomPtr;

class Exit : public GameObject
{
public:
	enum ExitId { WEST, NORTH, EAST, SOUTH, UP, DOWN, NULL_EXIT };
	Exit(ExitId id, const RoomPtr &to, const std::string &description, bool locked = false);
	virtual ~Exit();

	const std::string &getNameAlias() const { return name_alias; }

	void look() override;

	void add(const GameObjectPtr &object);
	void remove(const GameObjectPtr &object);
	const std::vector<GameObjectPtr> &getObjects() const { return objects; }

	const RoomPtr &getTo() const { return to; }
	ExitId getDirection() const { return id; }

	bool isLocked() const { return locked; }
	void setLock(bool lock) { locked = lock; }

	enum Setting
	{
		NULL_SETTING = 0,
		SLIPPERY_DOWN,
		SLIPPERY_UP
	};
	void add(Setting setting);
	bool has(Setting setting);

	static std::string getExitIdName(ExitId direction);
	static std::string getExitIdNameAlias(ExitId direction);
	static ExitId getOpposite(ExitId direction);

protected:
	std::vector<GameObjectPtr> objects;
	std::vector<Setting> settings;
	ExitId id;
	std::string name_alias;
	RoomPtr to;
	bool locked;
};
typedef std::shared_ptr<Exit> ExitPtr;
